<?php
/**
 *
 * 版权所有：网维科技<www.zt10000.com>
 * 作    者：Moro
 * 日    期：2017-03-15
 * 版    本：1.0.0
 * 功能说明：配置文件。
 *
 **/

namespace Ekadmin\Controller;

use Think\Controller;

class WeLoginController extends Controller
{
    public function index()
    {
        if(session_status() != PHP_SESSION_ACTIVE){
            @session_start();
        }

        $account = session('we8');
        $current_url = get_url();
        $key = 'addons/' . WE7_MODULE_NAME;



        $we7_url = mb_substr($current_url, 0, stripos($current_url, $key));
        $we7_url = 'https://'.$_SERVER['HTTP_HOST'];
        if(empty($account)){
            header('Location:'.$we7_url);
            exit();
        }

        $wxapp = M('wxapp')->where(['uniacid'=>$account['acid']])->find();
        if(!$wxapp){
            $add['uniacid'] = $account['acid'];
            $add['name']    =  $account['name'];
            $add['create_time'] = time();
            M('wxapp')->add($add);
        }


        $config = M('config')->where(['uniacid'=>$account['acid']])->find();
        if(!$config)
        {
           
            $add2['uniacid'] = $account['acid'];
           
            M('config')->add($add2);
        }

         header('Location:'.$we7_url.'/addons/yb_jielong/admin.php');
    }








}
?>